<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="/include/css/admin.css" rel="stylesheet" type="text/css">
<title>信息管理页面</title>
<script language="JavaScript" src="/include/js/forbidNew.js" type="text/JavaScript"></script>
<script language="JavaScript">
function doSave()
{
	
	EditForm.displaytime.value=getDisplayTime();	
	//alert(EditForm.displaytime.value);
	if(doCheck())
	{
		
		if(EditForm.cid.value!="")EditForm.parameter.value="update";		
		EditForm.content.value=htmlEdit.GetContents();		
		EditForm.submit();		
		
	}
	
}
function getDisplayTime()
{
	
	var year,month,day,hour,minute;	
	var d=new Date();	
	if(EditForm.displayYear.value=="")
	year=d.getYear();	
	else year=EditForm.displayYear.value;	
	if(EditForm.displayMonth.value=="")
	month=d.getMonth()+1;	
	else month=EditForm.displayMonth.value;	
	if(EditForm.displayDay.value=="")
	day=d.getDay()+1;	
	else day=EditForm.displayDay.value;	
	
	if(EditForm.displayHour.value=="")
	hour=d.getHours();	
	else hour=EditForm.displayHour.value;	
	
	if(EditForm.displayMinute.value=="")
	minute=d.getMinutes();	
	else minute=EditForm.displayMinute.value;	
	return year+"-"+month+"-"+day+" "+hour+":"+minute+":0";	
	
}
function doDel()
{
	
	if(EditForm.cid.value!="")
	{
		
		EditForm.parameter.value="del";		
		EditForm.submit();		
		
	}
	
}
function doCheck()
{
	
	if(EditForm.title.value=="")
	{
		
		alert("标题不能为空!");		
		EditForm.title.focus();		
		return false;		
		
	}
	return true;	
	
}
function doUpload(obj,upFrame,types)
{
	
	upFrame.EditForm.subCommand.value="NewsContent";	
	if(upFrame.EditForm.file.value!="")
	{
		
		upFrame.EditForm.parentObj.value=obj.name;		
		upFrame.EditForm.types.value=types;		
		upFrame.EditForm.submit();		
		
	}
	
}
function addAttach(type,value)
{
	
	//alert(obj.value);
	var obj;	
	if(type=="imgs")obj=EditForm.imgs;	
	else obj=EditForm.files;	
	if(obj.value.indexOf(value)<0)
	{
		
		if(obj.value!="")obj.value+=","+value;		
		else obj.value=value;		
		
	}
	
}
function addOptions(obj,value,text)
{
	
	alert(value);	
	var sel=eval("EditForm."+obj);	
	for(var i=0;i<sel.options.length;i++)
	{
		
		if(sel.options[i].text==text)sel.options[i]=null;		
		
	}
	var it=new Option(text,value);	
	sel.options[sel.options.length]=it;	
	
}
function insertImgs()
{
	
	//alert(EditForm.imgsSelect.value);
	var imgPath=EditForm.imgsSelect.value;	
	htmlEdit.insertHTML("<img src='/upfile/"+imgPath+"' border=0>");	
	
}
function init()
{
	
	setSelectValue(EditForm.displayYear,1999,2008);	
	setSelectValue(EditForm.displayMonth,1,12);	
	setSelectValue(EditForm.displayDay,1,31);	
	setSelectValue(EditForm.displayHour,1,24);	
	setSelectValue(EditForm.displayMinute,1,60);
	
	window.setTimeout('initValue()',500);	
	//alert(initValue());
	
}
function initValue()
{
	
	SetContents(contentSpan.innerHTML);
	
	if(EditForm.displaytime.value!="")
	{
		
		var s=EditForm.displaytime.value.split("-");		
		EditForm.displayYear.value=s[0];		
		EditForm.displayMonth.value=s[1];		
		EditForm.displayDay.value=s[2];		
		EditForm.displayHour.value=s[3];		
		EditForm.displayMinute.value=s[4];		
		
	}
	alert(htmlEdit.GetContents());
	
}
function setSelectValue(sel,begin,end)
{
	
	sel.options.length=1;	
	for(var i=begin,j=1;i<=end;i++,j++)
	{
		
		var op=new Option(i,i);		
		sel.options[j]=op;		
		
	}
	
}
function changeDetailSetting()
{
	
	detailSetting.style.display=(detailSetting.style.display=="none"?"":"none");	
	
}

function SetContents(innerHtml)
{
	htmlEdit.SetContents(innerHtml) ;
}

///ajax支持
/*function newXMLHttpRequest() {
  var xmlreq = false;
  if (window.XMLHttpRequest) { 
    xmlreq = new XMLHttpRequest();
  } else if (window.ActiveXObject) {    
    try {
      // 尝试按新版InternetExplorer方法创建
      xmlreq = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e1) {   
      try {
        xmlreq = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e2) {
     
      }
    }
  }
  return xmlreq;
}
function choiceCircle(v)
{
if(v.value!=""){
 var req = newXMLHttpRequest();
  req.onreadystatechange = doChoiceCircle(req);   
  req.open("POST", "/blogCircle.do?parameter=choiceCircle&inputuser="+v, true); 
  req.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
  req.send("");
  }
}
function doChoiceCircle(req) {  
return function () {
    if ((req.readyState==4) && (req.status == 200)) {       
		var objXMLDoc=new ActiveXObject("Microsoft.XMLDOM");	
        objXMLDoc.loadXML(req.responseText);		
		var data=objXMLDoc.selectNodes("//root/data");
		EditForm.circle.options.length=0;
		EditForm.circle.options[0]=new Option("","");
		for(var i=0;i<data.length;i++)
		{
		var op=new Option(data[i].getAttribute("title"),data[i].getAttribute("cid"));
		EditForm.circle.options[i+1]=op;
		}
      }   
 }
  }
  }*/
</script>  
</head>

<body onLoad="init();">
<table width="99%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td height="38" align="center" valign="bottom"><table width="96%" height="34"  border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td valign="middle"><table width="53%"  border="0" cellspacing="0" cellpadding="0">
          <tr>
                <td width="10%" valign="bottom"><img src="/images/system/ico/newsDir.jpg" width="32" height="32"></td>
                <td width="90%" valign="bottom" class="titletxt">书写Blog信息</td>
          </tr>
        </table></td>
        <td width="100">&nbsp;</td>
        <td width="120">&nbsp;		</td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td align="center" valign="top">
	
	<form id="EditForm" name="EditForm" method="post" action="/blogNewsDoc.do">		
	   <input type="hidden" name="parameter" value="add">	 
	   <input type="hidden" name="cid" value="$!cid">	  
       <input type="hidden" name="displaytime" value="$!CommUtil.formatDate('yyyy-M-d-H-m',$!displaytime)">  
       <table width="100%"   border="1" cellpadding="0" cellspacing="1">
          <tr  > 
            <td width="71" height="23" align="right" class="formLable">标题</td>
            <td  colspan="3"  class="formText">              <font color="#FF0000"> 
              <input name="title" type="text" id="title" value="$!title" style="width:80%">
            *</font></td>
          </tr>
          <tr> 
            <td width="71" height="23" align="right" class="formLable">所属栏目</td>
            <td width="195" align="left"   class="formText">
			<select name="dirSn">
                <option value="">请选择</option>$!TagUtil.options($dirService.queryBlogNewsDir($currentUser.userName,1,15).result,"cid","title",$dirSn)
            </select>
			
			
			<select id="circlesn" name="circlesn">
			<option>发表到圈子</option>
			$!TagUtil.options($circleService.queryAllUserCircle($currentUser.userName).result,"cid","title",$circlesn)
		    </select>			</td>
            <td width="53" align="right"  class="formLable">显示时间</td>
            <td width="428" align="left"   class="formText"><select name="displayYear">
              <option value="">选择</option>
              
            </select>
年
<select name="displayMonth">
  <option value="">选择</option>
</select>
月
<select name="displayDay">
  <option value="">选择</option>
</select>
日
<select name="displayHour">
  <option value="">选择</option>
</select>
时
<select name="displayMinute">
  <option value="">选择</option>
</select>
分</td>
          </tr>
          <tr > 
            <td  width="71"  align="right" class="formLable">引用来源</td>
            <td colspan="3"    class="formText"><font color="#FF0000">
              <input name="source" type="text" id="source" value="$!source" style="width:80%">
            </font></td>
          </tr>
        
		
		
          <tr > 
            <td colspan="4"  align="right" class="formLable">
              <textarea name="content" rows="2" class="smallInput" style="width:100%;display:none"></textarea>
              <span id="contentSpan" style="display:none">$!content</span>
              <!--<iframe id='htmlEdit' name='htmlEdit' width="100%" height="400" src="/include/system/htmlEdit.htm"></iframe> -->
		    <iframe id='htmlEdit' name='htmlEdit' width="100%" height="400" src="FCKeditor/fckeditor.html" scrolling="no"></iframe>			  <span id="htmlTempSpan" style="display:none"></span> </td>
          </tr>
		   <tr > 
            <td colspan="4"  align="right" class="formLable"><a href="#" onClick="changeDetailSetting()"><font color="#0000CC">显示详细选项&gt;&gt;</font></a>  &nbsp;&nbsp;&nbsp;&nbsp;</td>
          </tr>
		    <tr > 
            <td colspan="4"  align="right" class="formLable" >			<table width="100%"  border="1" id="detailSetting" style="display:none">
			   <tr > 
            <td  width="60"  align="right" class="formLable">文章简介</td>
            <td colspan="3"    class="formText"><textarea name="intro" rows="3" class="smallInput" id="textarea" style="width:100%">$!intro</textarea ></td>
          </tr>
          <tr > 
            <td width="60"  align="right" class="formLable">审核</td>
            <td    class="formText"><table width="100%"  border="0" height="100%">
              <tr>
                <td><input type="checkbox" name="auditing"  value="1" #if($!isauditing) checked #end></td>
                <td class="formLable">推荐</td>
                <td><input name="selected" type="checkbox" value="1" #if($!isselected) checked #end></td>
                <td><span class="formLable">作者</span></td>
                <td><input name="author" type="text" value="$!author" size="8"></td>
                <td class="formLable">评论</td>
                <td><input type="radio" name="radiobutton" value="radiobutton">
                  允许 
                    <input type="radio" name="radiobutton" value="radiobutton">
                    不允许匿名 
                    <input type="radio" name="radiobutton" value="radiobutton">
                    禁止</td>
              </tr>
            </table></td>
            <td align="right"   class="formLable">直接跳转URL</td>
            <td    class="formText"><input name="url" type="text" id="url" value="$!url" size="20" ></td>
          </tr>
          <tr > 
            <td width="60" align="right" class="formLable">图片</td>
            <td height="20" colspan="3"    class="formText"><table width="100%"  border="0">
              <tr>
                <td width="42%"><input name="imgs" type="text" id="imgs" style="width:100%" value="$!imgs"></td>
              <td width="6%" class="formLable">附件</td>
                <td width="42%"><input name="files" type="text" id="files" style="width:100%" value="$!files"></td>
              </tr>
            </table></td>
          </tr>
          
          <tr > 
            <td width="60"  align="right" class="formLable">文章类型</td>
            <td height="20" colspan="3"    class="formText"><table width="100%"  border="0">
                <tr>
                  <td><select name="types">
                    
                  $!typesOptions                 
              
                  </select>                  </td>
                <td align="right">文章状态
                  <select name="status">
                    
                      
                
                  $!statusOptions
                 
              
            
                    
                  </select></td>
                  <td align="right"><span class="formLable">录入人</span></td>
                  <td>$!inputuser</td>
                  <td align="right">录入时间</td>
                  <td>$!inputtime</td>
                </tr>
              </table></td>
          </tr>
            </table></td>
            </tr>
        </table>  
      </form>
    </td>
  </tr>
  <tr>
    <td height="40" align="left" valign="middle">
	<table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="0" class="toolTable">
        <tr> 
          <td width="55" align="left" valign="middle">&nbsp;</td>
          <td width="55" align="left" valign="middle"><input type="submit" name="Submit" value="保存" onClick="doSave();" class="colorButton"> 
          </td>
          <td width="55" align="left" valign="middle"><input type="submit" name="Submit2" value="删除" onClick="doDel();" class="colorButton"></td>
          <td width="55" valign="middle"><input type="submit" name="Submit3" value="返回" onClick="history.go(-1)" class="colorButton"></td>
          <td width="27" valign="middle">&nbsp;</td>
          <td width="28" valign="middle">&nbsp;</td>
          <td width="55" valign="middle">&nbsp;</td>
          <td valign="middle">&nbsp;</td>
        </tr>
      </table></td>
       
  </tr>
</table>
</body>
</html>
#if ($msg)
<script>
alert('$!msg');</script>
#end